﻿/**************************************************************
 * filename: apply_protocl.h
 * time: 2020.12.31 22:38
 * author: mason
 * email: zhaomangang@qq.com
 * describe: Definition of the application layer protocol.
 * ************************************************************/

#ifndef APPLY_PROTOCL_H
#define APPLY_PROTOCL_H


/********************消息类型******************************/

#define TYPE_LOGON_ERROR -1    //登录错误消息
#define TYPE_ERROR 0   //错误
#define TYPE_LOGIN 1  //登录
#define TYPE_LOGON_SUCCESS 2 //登录成功
#define TYPE_CHAT_PRIVATE 3  //私聊消息
/***********************end****************************/


/*********************错误码/错误信息***************************/

#define ERROR_CODE_CONNECT  0x0 //连接服务器失败
#define ERROR_CODE_LOGON_USER    0x01    //用户名错误
#define ERROR_CODE_LOGON_PASSWORD   0X02   //密码错误


#define ERROR_MESSAGE_LOGON_USER "Login fail,username/id error"
#define ERROR_MESSAGE_LOGON_PASSWORD    "Login fail,password error"
#define ERROR_MESSAGE_CONNECT   "Connect to server fail"


/*********nodename*******/
#define NODE_TYPE "type"
#define NODE_ID "id"
#define NODE_USERNAME "username"
#define NODE_PASSWORD "password"
#define NODE_ICON "icon"


#define STR_TYPE "type"
#define STR_ID  "id"
#define STR_PASSWORD "password"
#define STR_USERNAME "username"
#define STR_ICON    "icon"
#define STR_ERROR_CODE   "error_code"
#define STR_ERROR_MSG   "error_msg"
#define STR_FRIEND_ID "friend_id"
#define STR_FRIEND_NAME "friend_name"
#define STR_REMARK  "remark"
#define STR_NUM "num"
#define STR_RECV_ID "recv_id"
#define STR_SEND_ID "send_id"
#define STR_TIME "time"
#define STR_MESSAGE_DATA "data"
#define STR_REAL_NAME "realname"
#define STR_ADDRESS "address"
#define STR_MAIL "mail"
#define STR_VERIFY_CODE "verify_code"
#define STR_MSG "msg"


#define MESSAGE_LOGON_ERROR -1    //登录错误消息
#define MESSAGE_LOGON 1 //登录请求
#define MESSAGE_USERINFO   2   //用户信息
#define MESSAGE_FRIEND_LIST 3   //好友列表请求
#define MESSAGE_GROUP_LIST  4   //群组列表请求
#define MESSAGE_FRIEND_LIST_RESPONSE 5  //好友列表响应
#define MESSAGE_CHAT_DATE   6       //聊天消息
#define MESSAGE_REGISTER_REQ    7   //注册请求
#define MESSAGE_VERIFY_REQ  8   //验证码请求
#define MESSAGE_REGISTER_RPT    9   //注册结果
#endif // APPLY_PROTOCL_H
